/**
 * 
 */
package com.thor.palmmall.rest.sales.input.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.rest.chart.converter.SDateRangeConverter;
import com.thor.palmmall.rest.sales.input.ASalesInputCondition;
import com.thor.palmmall.spi.sales.input.SSalesInputCondition;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class SSalesInputConditionConverter
    implements Converter<ASalesInputCondition, SSalesInputCondition> {

  public static SSalesInputConditionConverter getInstance() {
    if (instance == null)
      instance = new SSalesInputConditionConverter();
    return instance;
  }

  private static SSalesInputConditionConverter instance;

  private SSalesInputConditionConverter() {
  }

  @Override
  public SSalesInputCondition convert(ASalesInputCondition source) {
    if (source == null) {
      return null;
    }
    SSalesInputCondition target = new SSalesInputCondition();
    target.setContractUuid(source.getContractUuid());
    target.setDateRange(SDateRangeConverter.getInstance().convert(source.getDateRange()));
    return target;
  }

}
